﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Printing;
using System.Windows.Shapes;
using System.Windows.Navigation;

namespace OpenRPOSBackOffice
{
    public partial class Schedule : Page
    {
        private List<CheckBox> groupCheckBoxList = new List<CheckBox>();
        private List<CheckBox> departmentCheckBoxList = new List<CheckBox>();
        private List<CheckBox> positionCheckBoxList = new List<CheckBox>();
        DateTime dtLastClick = System.DateTime.Now;
        DateTime dtLoaded;
        Regex rx = new Regex(".{20}");

        public ObservableCollection<ScheduleData> scheduleDataSource = new ObservableCollection<ScheduleData>();

        public Schedule()
        {
            InitializeComponent();
        }

        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            init();
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
        }

        // Executes when the user navigates to this page.
        public async void init()
        {
            this.IsEnabled = true;
            Globals.showWaitCursor(true);
            dtLoaded = DateTime.MinValue;

            // Only allow roles to be selected by managers...
            cmbRoles.Visibility = (Globals.currentLogin.col_Manager) ? Visibility.Visible : Visibility.Collapsed;
            lblRole.Visibility = cmbRoles.Visibility;
            cbShowPreferences.Visibility = cmbRoles.Visibility;
            btnEditTemplates.Visibility = cmbRoles.Visibility;
            cbShowPreferences.IsChecked = false;

            // Setup the initial period...
            dpPeriodStart.SelectedDate = Globals.dtScheduleStart;
            dgSchedules.Visibility = Visibility.Visible;

            // Load relevant data...
            await Globals.db.GetEmployeeObjects("Active=1 order by LastName, FirstName, MiddleInitial");
            await Globals.db.GetRoleObjects("Active=1 order by Title");
            await Globals.db.GetEmployeeRoleObjects("Active=1");
            await Globals.db.GetLoginObjects("");

            // Identify employees that are also managers
            Globals.lstManagers.Clear();
            foreach (ServiceReferenceOpenRPOS.Employee emp in Globals.db.EmployeeRecords)
                foreach (ServiceReferenceOpenRPOS.Login login in Globals.db.LoginRecords)
                    if ((emp.col_LoginID == login.col_ID) && (login.col_Manager))
                        Globals.lstManagers.Add(emp.col_ID);

            cmbRoles.Items.Clear();
            cmbRoles.Items.Add("All");
            foreach (ServiceReferenceOpenRPOS.Role role in Globals.db.RoleRecords)
            {
                cmbRoles.Items.Add(role.col_Title);
            }
            cmbRoles.SelectedIndex = 0;
            Globals.schedule = this;
            Globals.showWaitCursor(false);
        }

        private string getEmployeeWeekHoursTotal(int employeeID, DateTime scheduleDate, bool showPreference)
        {
            string employeeHours = "";
            TimeSpan ts = new TimeSpan();

            // Sum the shift totals for the week
            foreach (ServiceReferenceOpenRPOS.Schedule sch in Globals.db.ScheduleRecords)
            {
                if (sch.col_EmployeeID == employeeID && (sch.col_Start.Date >= scheduleDate.Date &&
                    sch.col_Start.Date < scheduleDate.Date.AddDays(Globals.k_int_days_in_week) || sch.col_RecurrenceType == 1) && sch.col_Preference == showPreference)
                {
                    ts += sch.col_Stop - sch.col_Start;
                }
            }
            employeeHours = ts.TotalHours.ToString("F02");

            return employeeHours;
        }

        private string getEmployeeScheduleNoteData(int employeeID, DateTime scheduleDate, bool manager)
        {
            string strReturn = "";

            if (cbShowNotes.IsChecked==true)
            {
                IEnumerable<ServiceReferenceOpenRPOS.ScheduleNote> query = Globals.db.ScheduleNoteRecords.Where(x => x.col_EmployeeID == employeeID &&
                    x.col_ScheduleDate.ToShortDateString() == scheduleDate.ToShortDateString() && x.col_Manager == manager);
                if (query.Count() > 0)
                    strReturn += "\nNote: " + query.First().col_NoteText;
                strReturn = strReturn.WordWrap(Globals.k_int_schedule_wrap_chars);                 
            }

            return strReturn;
        }

        private string getEmployeeScheduleData(int employeeID, DateTime scheduleDate, bool showPreference)
        {
            string strReturn = "", strStrRecurrence="";
            TimeSpan ts = new TimeSpan();            
            // Fill-in employee schedule information
            IEnumerable<ServiceReferenceOpenRPOS.Schedule> query = Globals.db.ScheduleRecords.OrderBy(sch => sch.col_Start);
            foreach (ServiceReferenceOpenRPOS.Schedule sch in query)
            {
                if (sch.col_EmployeeID == employeeID && (sch.col_Start.Date == scheduleDate.Date ||
                    (sch.col_RecurrenceType == 1 && sch.col_Start.DayOfWeek == scheduleDate.DayOfWeek)) && sch.col_Preference == showPreference)
                {
                    // This schedule record matches
                    strReturn += sch.col_Start.ToShortTimeString() + " - " + sch.col_Stop.ToShortTimeString() + "\n";
                    ts += sch.col_Stop - sch.col_Start;
                    strStrRecurrence = (sch.col_RecurrenceType == 1) ? " (R)" : "";
                    // Display the role as well
                    foreach (ServiceReferenceOpenRPOS.Role role in Globals.db.RoleRecords)
                        if (role.col_ID == sch.col_RoleID)
                            strReturn += role.col_Title + strStrRecurrence + "\n";
                    // Set recurrence records to the schedule date
                    if (sch.col_RecurrenceType == 1)
                    {
                        Globals.db.ScheduleRecords[Globals.db.ScheduleRecords.IndexOf(sch)].col_Start =
                            Globals.db.ScheduleRecords[Globals.db.ScheduleRecords.IndexOf(sch)].col_Start.AddDays(((scheduleDate.Date>sch.col_Start.Date)?1:-1)*Globals.k_int_days_in_week);
                        Globals.db.ScheduleRecords[Globals.db.ScheduleRecords.IndexOf(sch)].col_Stop =
                            Globals.db.ScheduleRecords[Globals.db.ScheduleRecords.IndexOf(sch)].col_Stop.AddDays(((scheduleDate.Date > sch.col_Stop.Date) ? 1 : -1) * Globals.k_int_days_in_week);
                    }
                }
            }
            
            if (strReturn.Length > 0)
            {
                strReturn += "Hours: " + ts.TotalHours.ToString("F02");
            }
            return strReturn;
        }

        private bool getOverlapStatus(int employeeID, DateTime scheduleDate, bool showPreference)
        {
            bool returnVal = false, init = false;
            DateTime dtLastStop=new DateTime();
            IEnumerable<ServiceReferenceOpenRPOS.Schedule> query = Globals.db.ScheduleRecords.OrderBy(sch => sch.col_Start);
            foreach (ServiceReferenceOpenRPOS.Schedule sch in query)
            {
                if (sch.col_EmployeeID == employeeID && (sch.col_Start.Date == scheduleDate.Date ||
                    (sch.col_RecurrenceType == 1 && sch.col_Start.DayOfWeek == scheduleDate.DayOfWeek)) && sch.col_Preference == showPreference)
                {
                    if (!init)
                    {
                        init = true;
                    }
                    else
                    {
                        if (dtLastStop.TimeOfDay > sch.col_Start.TimeOfDay)
                            returnVal = true;
                    }
                    dtLastStop = sch.col_Stop;
                }
            }
            return returnVal;
        }

        private async void initScheduleGrid(bool reload=false)
        {
            Globals.showWaitCursor(true);
            if (!Globals.dtScheduleStart.Equals(dtLoaded)||reload)
                await Globals.db.GetScheduleObjects("((Start between '" + Globals.dtScheduleStart.ToShortDateString() + "' and '" +
                    Globals.dtScheduleStart.AddDays(Globals.k_int_days_in_week).ToShortDateString() + "') or RecurrenceType=1) and ScheduleTemplateID=0 order by Start");
            dtLoaded = Globals.dtScheduleStart;
            // Get notes for this period
            if(cbShowNotes.IsChecked==true)
                await Globals.db.GetScheduleNoteObjects("");
            scheduleDataSource.Clear();
            dgSchedules.Columns[1].Header = "Hours";
            dgSchedules.Columns[2].Header = Globals.dtScheduleStart.DayOfWeek.ToString().Substring(0, 3) + " (" + Globals.dtScheduleStart.Month.ToString() + "/" + Globals.dtScheduleStart.Day.ToString() + ")";
            dgSchedules.Columns[2].Width = DataGridLength.Auto;
            dgSchedules.Columns[3].Header = Globals.dtScheduleStart.AddDays(1).DayOfWeek.ToString().Substring(0, 3) + " (" + Globals.dtScheduleStart.AddDays(1).Month.ToString() + "/" + Globals.dtScheduleStart.AddDays(1).Day.ToString() + ")";
            dgSchedules.Columns[3].Width = DataGridLength.Auto;
            dgSchedules.Columns[4].Header = Globals.dtScheduleStart.AddDays(2).DayOfWeek.ToString().Substring(0, 3) + " (" + Globals.dtScheduleStart.AddDays(2).Month.ToString() + "/" + Globals.dtScheduleStart.AddDays(2).Day.ToString() + ")";
            dgSchedules.Columns[4].Width = DataGridLength.Auto;
            dgSchedules.Columns[5].Header = Globals.dtScheduleStart.AddDays(3).DayOfWeek.ToString().Substring(0, 3) + " (" + Globals.dtScheduleStart.AddDays(3).Month.ToString() + "/" + Globals.dtScheduleStart.AddDays(3).Day.ToString() + ")";
            dgSchedules.Columns[5].Width = DataGridLength.Auto;
            dgSchedules.Columns[6].Header = Globals.dtScheduleStart.AddDays(4).DayOfWeek.ToString().Substring(0, 3) + " (" + Globals.dtScheduleStart.AddDays(4).Month.ToString() + "/" + Globals.dtScheduleStart.AddDays(4).Day.ToString() + ")";
            dgSchedules.Columns[6].Width = DataGridLength.Auto;
            dgSchedules.Columns[7].Header = Globals.dtScheduleStart.AddDays(5).DayOfWeek.ToString().Substring(0, 3) + " (" + Globals.dtScheduleStart.AddDays(5).Month.ToString() + "/" + Globals.dtScheduleStart.AddDays(5).Day.ToString() + ")";
            dgSchedules.Columns[7].Width = DataGridLength.Auto;
            dgSchedules.Columns[8].Header = Globals.dtScheduleStart.AddDays(6).DayOfWeek.ToString().Substring(0, 3) + " (" + Globals.dtScheduleStart.AddDays(6).Month.ToString() + "/" + Globals.dtScheduleStart.AddDays(6).Day.ToString() + ")";
            dgSchedules.Columns[8].Width = DataGridLength.Auto;

            foreach (ServiceReferenceOpenRPOS.Employee emp in Globals.db.EmployeeRecords)
            {
                // Only allow scheduling for employees with defined roles
                bool bShowSchedule = (cmbRoles.SelectedIndex == 0 && Globals.db.EmployeeRoleRecords.Any(x => x.col_EmployeeID == emp.col_ID));
                // Filter on roles, if requested
                if (cmbRoles.SelectedIndex > 0)
                    bShowSchedule = Globals.db.EmployeeRoleRecords.Any(x => x.col_RoleID == Globals.db.RoleRecords[cmbRoles.SelectedIndex-1].col_ID && x.col_EmployeeID==emp.col_ID);
                if (!Globals.currentLogin.col_Manager)
                    bShowSchedule = (emp.col_ID == Globals.currentEmployee.col_ID);
                if (bShowSchedule)
                {
                    ScheduleData sd = new ScheduleData()
                    {
                        Name = emp.col_LastName + ", " + emp.col_FirstName + " " + emp.col_MiddleInitial,
                        EmployeeID = emp.col_ID,
                        Preference = false,
                        Hours = getEmployeeWeekHoursTotal(emp.col_ID, Globals.dtScheduleStart, false),
                        Day0 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart, false) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart, true),
                        Day0Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart, false),
                        Day1 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(1), false) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(1), true),
                        Day1Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(1), false),
                        Day2 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(2), false) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(2), true),
                        Day2Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(2), false),
                        Day3 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(3), false) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(3), true),
                        Day3Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(3), false),
                        Day4 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(4), false) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(4), true),
                        Day4Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(4), false),
                        Day5 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(5), false) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(5), true),
                        Day5Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(5), false),
                        Day6 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(6), false) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(6), true),
                        Day6Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(6), false)
                    };
                    scheduleDataSource.Add(sd);

                    // Determine if shedule preferences should be displayed
                    if ((cbShowPreferences.IsChecked == true && !Globals.lstManagers.Contains(emp.col_ID)) || !Globals.currentLogin.col_Manager)
                    {
                        ScheduleData sdPref = new ScheduleData()
                        {
                            Name = emp.col_LastName + ", " + emp.col_FirstName + " " + emp.col_MiddleInitial + " (Preference)",
                            EmployeeID = emp.col_ID,
                            Preference = true,
                            Hours = getEmployeeWeekHoursTotal(emp.col_ID, Globals.dtScheduleStart, true),
                            Day0 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart, true) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart, false),
                            Day0Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart, true),
                            Day1 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(1), true) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(1), false),
                            Day1Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(1), true),
                            Day2 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(2), true) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(2), false),
                            Day2Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(2), true),
                            Day3 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(3), true) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(3), false),
                            Day3Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(3), true),
                            Day4 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(4), true) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(4), false),
                            Day4Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(4), true),
                            Day5 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(5), true) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(5), false),
                            Day5Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(5), true),
                            Day6 = getEmployeeScheduleData(emp.col_ID, Globals.dtScheduleStart.AddDays(6), true) + getEmployeeScheduleNoteData(emp.col_ID, Globals.dtScheduleStart.AddDays(6), false),
                            Day6Overlap = getOverlapStatus(emp.col_ID, Globals.dtScheduleStart.AddDays(6), true)
                        };
                        scheduleDataSource.Add(sdPref);
                    }
                }
            }

            dgSchedules.ItemsSource = scheduleDataSource;

            Globals.showWaitCursor(false);
        }

        public void refreshData(bool reload=false)
        {
            // Re-initialize the data in the grid
            initScheduleGrid(reload);
        }

        private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            resizeGrid();
        }

        public void resizeGrid()
        {
            double newWidth = Application.Current.Host.Content.ActualWidth;
            double newHeight = Application.Current.Host.Content.ActualHeight - Globals.k_int_schedule_edit_height_offset;
            if (dgSchedules.Width != newWidth || dgSchedules.Height != newHeight)
            {
                dgSchedules.Width = newWidth;
                dgSchedules.Height = newHeight;
            }
        }

        private void btnNextPeriod_Click(object sender, RoutedEventArgs e)
        {
            dpPeriodStart.SelectedDate = Globals.dtScheduleStart.AddDays(Globals.k_int_days_in_week);
        }

        private void btnPrevPeriod_Click(object sender, RoutedEventArgs e)
        {
            dpPeriodStart.SelectedDate = Globals.dtScheduleStart.AddDays(-1 * Globals.k_int_days_in_week);
        }

        private void dgSchedules_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Space)
            {
                doCellEdit();
            }
        }

        private void dgSchedules_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DateTime dtCurrClick = DateTime.Now;
            // Test for "Double-Click"
            if (dtCurrClick.Ticks - dtLastClick.Ticks < Globals.k_long_max_ticks_between_clicks)
                doCellEdit();
            dtLastClick = dtCurrClick;
        }

        private void doCellEdit()
        {
            ScheduleData sd=(ScheduleData)(dgSchedules.SelectedItem);
            if ((!sd.Preference && Globals.currentLogin.col_Manager) || (sd.Preference && !Globals.currentLogin.col_Manager))
            {
                if (dgSchedules.CurrentColumn.DisplayIndex > 1)
                {
                    CellEditor ce = new CellEditor();
                    ce.init(sd.EmployeeID, Globals.dtScheduleStart.AddDays(dgSchedules.CurrentColumn.DisplayIndex - 2));
                    ce.Show();
                }
                else if (dgSchedules.CurrentColumn.DisplayIndex == 0) // Edit period
                {
                    PeriodEditor pe = new PeriodEditor();
                    pe.init(sd.EmployeeID, Globals.dtScheduleStart);
                    pe.Show();
                }
                dgSchedules.SelectedItem = null;
            }
        }

        private void dpPeriodStart_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            // Load the new period
            Globals.dtScheduleStart = (DateTime)dpPeriodStart.SelectedDate;
            Globals.dtScheduleStart = Globals.dtScheduleStart.WeekStart(Globals.k_dow_week_start);
            if (Globals.dtScheduleStart != (DateTime)dpPeriodStart.SelectedDate)
                dpPeriodStart.SelectedDate = Globals.dtScheduleStart;
            else
                initScheduleGrid();
        }

        private void cmbRoles_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            initScheduleGrid();
        }

        private void dgSchedules_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            FrameworkElement el;
            DataGridCell cell;
            SolidColorBrush overlapBrush = new SolidColorBrush(Color.FromArgb(255, 255, 160, 122));
            SolidColorBrush standardBrush = new SolidColorBrush(Color.FromArgb(255, 255, 250, 250));
            // Check each day
            el = dgSchedules.Columns[2].GetCellContent(e.Row);
            cell = el.Parent as DataGridCell;
            cell.Background = (scheduleDataSource[e.Row.GetIndex()].Day0Overlap) ? overlapBrush : standardBrush;
            el = dgSchedules.Columns[3].GetCellContent(e.Row);
            cell = el.Parent as DataGridCell;
            cell.Background = (scheduleDataSource[e.Row.GetIndex()].Day1Overlap) ? overlapBrush : standardBrush;
            el = dgSchedules.Columns[4].GetCellContent(e.Row);
            cell = el.Parent as DataGridCell;
            cell.Background = (scheduleDataSource[e.Row.GetIndex()].Day2Overlap) ? overlapBrush : standardBrush;
            el = dgSchedules.Columns[5].GetCellContent(e.Row);
            cell = el.Parent as DataGridCell;
            cell.Background = (scheduleDataSource[e.Row.GetIndex()].Day3Overlap) ? overlapBrush : standardBrush;
            el = dgSchedules.Columns[6].GetCellContent(e.Row);
            cell = el.Parent as DataGridCell;
            cell.Background = (scheduleDataSource[e.Row.GetIndex()].Day4Overlap) ? overlapBrush : standardBrush;
            el = dgSchedules.Columns[7].GetCellContent(e.Row);
            cell = el.Parent as DataGridCell;
            cell.Background = (scheduleDataSource[e.Row.GetIndex()].Day5Overlap) ? overlapBrush : standardBrush;
            el = dgSchedules.Columns[8].GetCellContent(e.Row);
            cell = el.Parent as DataGridCell;
            cell.Background = (scheduleDataSource[e.Row.GetIndex()].Day6Overlap) ? overlapBrush : standardBrush;
        }

        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            Globals.Print(dgSchedules, "Schedule", true);
        }

        private void cbShowPreferences_Checked(object sender, RoutedEventArgs e)
        {
            initScheduleGrid();
        }

        private void cbShowPreferences_Unchecked(object sender, RoutedEventArgs e)
        {
            initScheduleGrid();
        }

        private void btnEditTemplates_Click(object sender, RoutedEventArgs e)
        {
            // Bring up the "Edit Templates" dialog...
            ScheduleTemplateEditor ste = new ScheduleTemplateEditor();
            ste.init(Globals.dtScheduleStart);
            ste.Show();
        }

        private void cbShowNotes_Checked(object sender, RoutedEventArgs e)
        {
            initScheduleGrid();
        }

        private void cbShowNotes_Unchecked(object sender, RoutedEventArgs e)
        {
            initScheduleGrid();
        }
    }

    public class ScheduleData
    {
        public string Name { get; set; }
        public int EmployeeID { get; set; }
        public string Hours { get; set; }
        public bool Preference { get; set; }
        public string Day0 { get; set; }
        public bool Day0Overlap { get; set; }
        public string Day1 { get; set; }
        public bool Day1Overlap { get; set; }
        public string Day2 { get; set; }
        public bool Day2Overlap { get; set; }
        public string Day3 { get; set; }
        public bool Day3Overlap { get; set; }
        public string Day4 { get; set; }
        public bool Day4Overlap { get; set; }
        public string Day5 { get; set; }
        public bool Day5Overlap { get; set; }
        public string Day6 { get; set; }
        public bool Day6Overlap { get; set; }
        public DateTime StartDate { get; set; }
    }
}
